import os, sys
import tornado.ioloop
import tornado.web


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        print(self.request)
        self.render("index.html")


ROOT_PATH, _ = os.path.split(os.path.abspath(sys.argv[0]))
appSettings = {
    'debug': True,
    'template_path': ROOT_PATH + '/template',
    'static_path': ROOT_PATH + '/static',
    'compress_response': True
}
application = tornado.web.Application([
    ("/", MainHandler),
    (r'^/(.*?)$', tornado.web.StaticFileHandler, dict(path=appSettings['template_path'])),
], **appSettings)

if __name__ == "__main__":
    application.listen(4200, xheaders=True)
    tornado.ioloop.IOLoop.current().start()
